package com.gpb.common.utils;


/**
 * 银联错误消息
 * @author 郭彭彬
 *
 */
public enum UPayResult {
	R_00("00","交易成功","支付成功"),
	R_03("03","交易通讯超时，请发起查询交易","交易超时，请先到《个人中心 -> 充值记录》中查询交易记录"),
	R_04("04","交易状态未明，请查询对账结果(04Z3003)","对不起，交易超时、请重新操作"),
	R_10("10","报文域(证件号码)格式错误","对不起，您输入的信息有误，请重新确认"),
	R_13("13","报文交易要素缺失","输入有误，请查证后再试"),
	R_14("14","输入有误，请查证后再试","输入有误，请查证后再试"),
	R_33("33","交易金额超限，交易失败(3330036)","对不起，您的可用金额不足、请更换银行卡"),
	R_39("39","交易不在受理时间范围内","交易不在受理时间范围内"),
	R_42("42","扣款成功但交易超过规定支付时间","交易仍在进行，请等待我们的回复"),
	R_60("60","交易异常，支付失败。详情请咨询95516(6030001)","交易异常，请重试"),
	R_61("61","该商户暂不支持该卡或卡号输入有误","该卡暂不支持，请更换银行卡"),
	R_62("62","交易失败，发卡银行不支持该商户，请更换其他银行卡","对不起，该卡不支持，请咨询该卡所属银行"),
	R_64("64","余额不足，请查询","账户余额不足，请更换银行卡"),
	R_65("65","您的卡已过期或者是您输入的有效期不正确，支付失败","您的银行卡已过期或卡号错误，请查证后再试"),
	R_66("66","您输入的证件号、姓名或手机号有误","您的输入信息有误，请重新输入"),
	R_68("68","您的银行卡暂不支持在线支付业务，请向您的银行咨询如何加办银联在线支付","该卡暂不支持银联在线支付，请向该银行咨询如何办理"),
	R_69("69","输入超时、交易失败","等待时间过长、请重新操作"),
	R_73("73","支付卡已超过有效期","对不起，您的卡已过期，请使用其他银行卡"),
	R_77("77","银行卡未开通认证支付","您的银行卡未开通在线支付 请拨打 95516 电话开通"),
	
//	R_04("04","交易状态未明，请查询对账结果","支付失败，请重试"),
//	R_10("10","报文域(证件号码)格式错误","您的输入信息有误，请查证后再试"),
//	R_33("33","交易金额超限","交易金额超限"),
//	R_60("60","交易异常，支付失败。详情请咨询95516(6030001)","支付异常，请重试"),
//	R_61("61","该商户暂不支持该卡或卡号输入有误","您输入的卡号无效或该卡不支持，请查证后再试"),
//	R_64("64","余额不足，请查询","账户余额不足，请更换银行卡"),
//	R_65("65","您的卡已过期或者是您输入的有效期不正确，支付失败","您的银行卡已过期或卡号错误，请查证后再试"),
//	R_66("66","您输入的证件号、姓名或手机号有误","您的输入信息有误，请查证后再试"),
//	R_68("68","该银行卡未开通银联在线支付业务","该卡暂不支持银联在线支付，请您向银行咨询办理"),
	R_err("err","支付请求失败","支付失败，请重试");
	
	
	
	String code;
	String msg;
	String custommsg;
	UPayResult(String code,String msg,String custommsg){
		this.code=code;
		this.msg=msg;
		this.custommsg=custommsg;
	}
	/**
	 * 获取自定义消息
	 * @param code
	 * @return
	 */
	public static String getCMsg(String code,String cmsg){
		UPayResult[] decs=UPayResult.values();
		for (int i=decs.length-1;i>=0;i--) {
			if(decs[i].code.equals(code)){
				return "【"+decs[i].custommsg+"】";
			}
		}
		return "银行:【"+cmsg+"】";
	}
	/**
	 * 获取消息
	 * @param code
	 * @return
	 */
	public static String getMsg(String code){
		UPayResult[] decs=UPayResult.values();
		for (int i=decs.length-1;i>=0;i--) {
			if(decs[i].code.equals(code)){
				return decs[i].msg;
			}
		}
		return null;
	}
}
